Skip to content

Implementation for complex sorting of dndarrays - #2482

Open
Berkant03 wants to merge 66 commits into
mainfrom
features/2372-complex_sort
Open

Implementation for complex sorting of dndarrays#2482
Berkant03 wants to merge 66 commits into
mainfrom
features/2372-complex_sort

Conversation

@Berkant03

Copy link
Copy Markdown
Collaborator

Due Diligence

  • General:
  • Implementation:
    • unit tests: all split configurations tested
    • unit tests: multiple dtypes tested
    • NEW unit tests: MPS tested (1 MPI process, 1 GPU)
    • benchmarks: created for new functionality
    • benchmarks: performance improved or maintained
    • documentation updated where needed

Description

Use vectorized_sort to implement a complex sort similar to np.sort_complex.

Issue/s resolved: #2372

Changes proposed:

  • Create a ht.sort_complex similar to np.sort_complex.
  • Reuse row exchange fuctionality of vectorized_sort.

Type of change

  • New feature (non-breaking change which adds functionality)

Does this change modify the behaviour of other functions? If so, which?

  • vectorized_sort, extraction of the communication logic into a seperate function.

Stack created with GitHub Stacks CLIGive Feedback 💬

@github-project-automation github-project-automation Bot moved this to Todo in Roadmap Aug 24, 2026
@Berkant03 Berkant03 changed the title Implemenation for complex sorting of dndarrays Implementation for complex sorting of dndarrays Aug 24, 2026
@brownbaerchen
brownbaerchen marked this pull request as draft August 25, 2026 10:37
@brownbaerchen

Copy link
Copy Markdown
Collaborator

I marked the PR as draft because I couldn't find any actual implementation or tests for the new feature.

@brownbaerchen
brownbaerchen force-pushed the features/2372-complex_sort branch from daf9b19 to 5bc0d77 Compare August 25, 2026 13:44
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@brownbaerchen
brownbaerchen force-pushed the features/2372-complex_sort branch from 0f36767 to 7d610a4 Compare August 26, 2026 08:24
Base automatically changed from 363-vectorized-sorting to main August 26, 2026 14:11
@brownbaerchen
brownbaerchen force-pushed the features/2372-complex_sort branch from 7d610a4 to a886580 Compare August 26, 2026 14:11
Comment thread heat/core/manipulations.py Outdated

@brownbaerchen brownbaerchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pointed out a few places where outdated code needs to be removed, mostly as a note to myself...

Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated

@brownbaerchen brownbaerchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resplit_result in sort_complex not implemented

Comment thread heat/core/manipulations.py
Comment thread heat/core/manipulations.py Outdated
Berkant03 and others added 2 commits September 8, 2026 15:34
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>

@brownbaerchen brownbaerchen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more small things... Sorry about that :D

Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py Outdated
Comment thread heat/core/manipulations.py
Comment thread heat/core/manipulations.py Outdated
assert np.isclose(res.numpy(), expected_res).all()
assert a.device == res.device
assert np.equal(sort_idx, res_idxs.numpy()).all()
assert a.device == res_idxs.device

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests that the split is what we expect? Since we are touching this above, and since we were missing something with the devices last time, I think this would be useful.

Comment thread tests/core/test_sorting.py
Berkant03 and others added 15 commits September 8, 2026 17:36
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
- added assertion for global index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

ht.sort should support complex input

2 participants